/*
 * Created on 08/23/2011 - 10:30 PM
 */
package sembr.geometry.shapes;

import importadorDXF.Dxf3DFACE;
import mathematics.Point3D;
import sembr.geometry.interfacing.ShapeBase;

/**
 *
 * @author Adriano
 */
public class FaceCollector extends ShapeBase<Dxf3DFACE> 
{
    public FaceCollector() 
    { }

    private Point3D[] getCornersFromFace(int index) 
    {
        return getCurrentElement(index).getCorners();
    }
    
    public double[][] getCornersCoordenatesFromFace(int index)
    {      
        int nrOfCorners = nrOfCorners(index);
        // coordenates in 3D
        double[][] tempCoordenates = new double[nrOfCorners][3];
        Point3D[] points = this.getCornersFromFace(index);        
        
        for(int i = 0; i < nrOfCorners; i++)
        {
            tempCoordenates[i][0] = points[i].x;
            tempCoordenates[i][1] = points[i].y;
            tempCoordenates[i][2] = points[i].z;
        }
        
        return tempCoordenates;
    }
    
    public int nrOfCorners(int index)
    {
        return getCurrentElement(index).getCorners().length;
    }
}
